package cn.brilliantfuture.commentry.entity;

// Generated 2010-10-14 14:06:42 by Hibernate Tools 3.3.0.GA

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.validator.Length;
import org.hibernate.validator.NotNull;

/**
 * ProductPriceOrderInformation generated by hbm2java
 */
@Entity
@Table(name = "order_product_info", catalog = "cabinet")
public class OrderProductInfo implements java.io.Serializable {

	private static final long serialVersionUID = -7373082488924762182L;
	private Integer orderProductInfoId;
	private OrderInformation orderInformation;
	private String productName;
	private Integer productInfoId;
	private double price;
	private Integer amount;
	private String unit;
	private double totalPrice;
	private String resumeCode;
	private Date insertTime;
	private boolean deleted;

	public OrderProductInfo() {
	}

	public OrderProductInfo(Integer orderProductInfoId, String productName,
			double price, OrderInformation orderInformation) {
		this.orderProductInfoId = orderProductInfoId;
		this.productName = productName;
		this.price = price;
		this.orderInformation = orderInformation;
	}

	public OrderProductInfo(Integer orderProductInfoId,
			OrderInformation orderInformation, Date insertTime, String unit) {
		this.orderProductInfoId = orderProductInfoId;
		this.orderInformation = orderInformation;
		this.insertTime = insertTime;
		this.unit = unit;
	}

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "order_product_info_id", unique = true, nullable = false)
	public Integer getOrderProductInfoId() {
		return this.orderProductInfoId;
	}

	public void setOrderProductInfoId(Integer orderProductInfoId) {
		this.orderProductInfoId = orderProductInfoId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "order_information_id", nullable = false)
	@NotNull
	public OrderInformation getOrderInformation() {
		return this.orderInformation;
	}

	public void setOrderInformation(OrderInformation orderInformation) {
		this.orderInformation = orderInformation;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "insert_time", length = 19)
	public Date getInsertTime() {
		return this.insertTime;
	}

	public void setInsertTime(Date insertTime) {
		this.insertTime = insertTime;
	}

	@Column(name = "product_name", nullable = false)
	@NotNull
	public String getProductName() {
		return productName;
	}

	public void setProductName(String productName) {
		this.productName = productName;
	}

	@Column(name = "deleted")
	public boolean isDeleted() {
		return deleted;
	}

	public void setDeleted(boolean deleted) {
		this.deleted = deleted;
	}

	@Column(name = "amount", nullable = false)
	@NotNull
	public Integer getAmount() {
		return amount;
	}

	public void setAmount(Integer amount) {
		this.amount = amount;
	}

	@Column(name = "price", precision = 22, scale = 0, nullable = false)
	@NotNull
	public double getPrice() {
		return price;
	}

	public void setPrice(double price) {
		this.price = price;
	}

	public void setTotalPrice(double totalPrice) {
		this.totalPrice = totalPrice;
	}

	// 计算每一个购物项的钱数
	@Column(name = "totalPrice", precision = 22, scale = 0, nullable = false)
	@NotNull
	public double getTotalPrice() {
		return totalPrice;
	}

	@Column(name = "unit", nullable = true)
	@Length(max = 50)
	public String getUnit() {
		return unit;
	}

	public void setUnit(String unit) {
		this.unit = unit;
	}

	@Column(name = "product_info_id")
	public Integer getProductInfoId() {
		return productInfoId;
	}

	public void setProductInfoId(Integer productInfoId) {
		this.productInfoId = productInfoId;
	}
	
	@Column(name = "resume_code", length = 50)
	public String getResumeCode() {
		return resumeCode;
	}

	public void setResumeCode(String resumeCode) {
		this.resumeCode = resumeCode;
	}
}
